package com.ufsoft.ntb.table.test;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Frame;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import nc.tb.pub.util.NtbLogger;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class Dialog1 extends JDialog {
  JPanel panel1 = new JPanel();
  BorderLayout borderLayout1 = new BorderLayout();
  JPanel jPanel1 = new JPanel();
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();

  public Dialog1(Frame frame, String title, boolean modal) {
    super(frame, title, modal);
    try {
      jbInit();
      pack();
    }
    catch(Exception ex) {
    	NtbLogger.error(ex);
    }
  }

  public Dialog1() {
    this(null, "", false);
  }

  private void jbInit() throws Exception {
    int row = 25,col = 14;
    String[][] contents = new String[row][col];
    String[] colHeader = new String[col];
   for (int i = 0; i < row; i++) {
     for (int j=0; j<col; j++) {
       contents[i][j] = "row"+i+"col"+j;
     }
   }
   for (int i = 0; i < colHeader.length; i++) {
     colHeader[i] = "h"+i;
   }

  JTable jTable1 = new JTable(contents,colHeader);
//  jTable1.setColumnSelectionAllowed(true);
 jTable1.setSelectionBackground(Color.red);
//  DateFormat fmt =
    panel1.setLayout(borderLayout1);
    jButton1.setText("jButton1");
    jButton2.setText("jButton2");
    getContentPane().add(panel1);
    JScrollPane sPane = new JScrollPane();
    sPane.setViewportView(jTable1);
    panel1.add(sPane, BorderLayout.CENTER);
    panel1.add(jPanel1, BorderLayout.SOUTH);
    jPanel1.add(jButton1, null);
    jPanel1.add(jButton2, null);
  }
  public static void main(String[] args) {
    Dialog1 dia = new Dialog1();
    dia.setSize(400,350);
    dia.setVisible(true);
  }
}
